import { searchCover } from "@/common.js"
// 改变日期
export const changeDate = function (e) {
  let formData = searchCover(this.formData, {id: this.item.id}, v => ({...v, value: e, errmsg: e ? '' : v.errmsg}))
  formData = formData.map(v => ({...v, children: v.type == 'split' ? searchCover(v.children, {id: this.item.id}, v => ({...v, value: e, errmsg: e ? '' : v.errmsg})) : v.children}))
  // 更新当前条目
  const item = {...this.item, value: e, errmsg: e ? '' : this.item.errmsg}
  this.$emit('setItem', item)
  // 更新整体表单的值
  this.$emit('setFormData', formData)
  eval(this.item.onChange)(e)
}